<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>资金请款与资金到位对账表</title>
	<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/Top.css" />
	<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/style.css" />
	<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/easyui/themes/default/easyui.css" />
	<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/easyui/themes/icon.css" />
	<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/buttons.css" />
	<link rel="stylesheet" type="text/css" href="/jxcsxm/js/autocomplete/jquery.autocomplete.css" />
	<script type="text/javascript" src="${pageContext.request.contextPath}/easyui/jquery-1.9.1.min.js"></script>
	<script type="text/javascript" src="${pageContext.request.contextPath}/easyui/jquery.easyui.min.js"></script>
	<script type="text/javascript" src="${pageContext.request.contextPath}/easyui/datagrid-detailview.js"></script>
	<script type="text/javascript" src="${pageContext.request.contextPath}/easyui/easyui-lang-zh_CN.js"></script>
	<script type="text/javascript" src="${pageContext.request.contextPath}/js/util/jquery.cookie.js"></script>
	<script type="text/javascript" src="${pageContext.request.contextPath }/js/uploader/swfobject.js"></script>
	<script type="text/javascript" src="${pageContext.request.contextPath}/js/uploader/jquery.uploadify.v2.1.4.js"></script>
	<script type="text/javascript" src="${pageContext.request.contextPath }/widget/newlhgdialog/lhgcore.min.js"></script>
	<script type="text/javascript" src="${pageContext.request.contextPath }/widget/newlhgdialog/lhgdialog.min.js"></script>
	<script type="text/javascript" src="${pageContext.request.contextPath}/js/YMLib.js"></script>
	<script type="text/javascript" src="${pageContext.request.contextPath}/js/YWLib.js"></script>
 	<script type="text/javascript" src="${pageContext.request.contextPath}/js/autocomplete/jquery.autocomplete.js" ></script>
	
	<style type="text/css">
		<!--
		a:link {text-decoration: none;}
		a:visited {text-decoration: none;}
		a:hover {text-decoration: none;}
		a:active {text-decoration: none;}
		#bbtable {border-collapse:collapse;}
		#bbtable thead tr td {text-align:center;font-size:1em;font-weight:bold;border:1px solid #FFEBCD;padding:3px 7px 2px 7px;}
		#bbtable tbody tr td {text-align:center;font-size:1em;border:1px solid #FFEBCD;padding:3px 7px 2px 7px;}
		-->
	</style>
	<script type="text/javascript">
	$(function(){
		// autoCompleteXmmc();
		loadUnit1("gydw",$.cookie("unit"));
		loadBmbm3('xmnf','项目年份');
		loadBmbm3('zjlx','资金类型');
		loadBmbm3('sfqbtxdw','是否');
		loadjhxdwh("jwh",'sbjhzjtj');
		getTbXmList();
		//console.log($.cookie("unit"))//省级是36
	});
		
	function autoCompleteXmmc(){
		$("#xmmc").autocomplete("/jxcsxm/tjbb/autoxmmc.do", {
			multiple : false,
			minChars :1,
			multipleSeparator : ' ',
			mustMatch: true,
	  		cacheLength : 0,
	  		delay : 0,
	  		max : 150,
	  		extraParams : {
	  				"xmjbxx.xmmc":function() {
	  				var d = $("#xmmc").val();
	  				return d;
	  			}
	  		},
	  		dataType : 'json',// 返回类型
	  		// 对返回的json对象进行解析函数，函数返回一个数组
	  		parse : function(data) {
	  			var aa = [];
	  			aa = $.map(eval(data), function(row) {
	  					return {
	  						data : row,
	  						value : row.xmmc.replace(/(\s*$)/g,""),
	  						result : row.xmmc.replace(/(\s*$)/g,"")
	  					};
	  				});
	  			return aa;
	  		},formatItem : function(row, i, max) {
	  			return row.xmmc.replace(/(\s*$)/g,"");
	  		}
	  	}).result(function(e, item) {
	  		
		});
	}
	
	
	
	function getTbXmList(){
		/* var xzqhdm=$("#xzqh").combotree("getValues");
		var xzqhstr="";
		if(xzqhdm.length==0){
			xzqhstr= $.cookie("dist2");
		}else if(xzqhdm.length==1){
			if(xzqhdm[0].substr(xzqhdm[0].length-2,xzqhdm[0].length)=="00") xzqhdm[0]=xzqhdm[0].substr(0,xzqhdm[0].length-2);
			if(xzqhdm[0].substr(xzqhdm[0].length-2,xzqhdm[0].length)=="00") xzqhdm[0]=xzqhdm[0].substr(0,xzqhdm[0].length-2);
			xzqhstr=xzqhdm[0] ;
		}else{
			xzqhstr= xzqhdm.join(',');
		} */
		var  gydwstr;

		var gydwdm=$("#gydw").combotree("getValues");
		if(gydwdm.length==0){
			gydwstr= $.cookie("unit2");

		}else if(gydwdm.length==1){
			if(gydwdm[0].substr(gydwdm[0].length-2,gydwdm[0].length)=="00") gydwdm[0]=gydwdm[0].substr(0,gydwdm[0].length-2);
			if(gydwdm[0].substr(gydwdm[0].length-2,gydwdm[0].length)=="00") gydwdm[0]=gydwdm[0].substr(0,gydwdm[0].length-2);
			gydwstr=gydwdm[0] ;
		}else{
			gydwstr= gydwdm.join(',');
		}

		var jhxdwh=$("#jwh").combobox("getText");
		if(jhxdwh.substr(0,1)==',')
			jhxdwh=jhxdwh.substr(1,jhxdwh.length);

		var zjlx=$("#zjlx").combobox("getValues").join(",");
		if(zjlx.substr(0,1)==',')
			zjlx=zjlx.substr(1,zjlx.length);

		var sfqbtxdw=$("#sfqbtxdw").combobox("getValues").join(",");
		if(sfqbtxdw.substr(0,1)==',')
			sfqbtxdw=sfqbtxdw.substr(1,sfqbtxdw.length);

		var params={
				'xmjbxx.xmmc':$("#xmmc").val(),
				'xmjbxx.xmnf':getValuesById("xmnf"),
				'xmjbxx.dwdm':gydwstr,
				'xmjbxx.jwh':jhxdwh,
				'xmjbxx.zjlx':zjlx,
				'xmjbxx.sfqbtxdw':sfqbtxdw
			//省级是36
			// 	'xmjbxx.dwdm': $.cookie("unit") === '36'?'':$.cookie("unit"),
			};
		
		
		$('#grid').datagrid({    
		    // url:'/jxcsxm/tjbb/selectsbzjList.do',
		    // url:'/jxcsxm/tjbb/selectDfzczjlrList.do',
		    url:'/jxcsxm/tjbb/selectZjqkdwdzbList.do',
		    striped:true,
		    pagination:true,
		    rownumbers:true,
		    pageNumber:1,
		    pageSize:10,
		    checkOnSelect:true,
		    height:$(window).height()-135,
		    width:$('#righttop').width()-22,
		    queryParams: params,
		    columns:[[	 
			    {field:'xmmc',title:'项目名称',width:300,align : 'center'},
			    {field:'xmnf',title:'项目年份',width:70,align : 'center'},
			    {field:'jwh',title:'局文号',width:150,align : 'center'},
			    {field:'zjlx',title:'资金类型',width:150,align : 'center'},
			    {field:'dwmc',title:'单位名称',width:150,align : 'center'},
				{field:'qkzj',title:'请款资金',width:100,align : 'center'},
			    {field:'dwzj',title:'到位资金',width:100,align : 'center'}
		    ]],
		    // view: detailview,
			detailFormatter:function(index,row){  
		        return '<div style="padding:2px"><table id="table_lx' + row.id + '"></table></div>';   
		    },
		    onLoadSuccess: function(){
	            var dg = $(this);
	            var rows=dg.datagrid("getRows");
				datalist = rows.length;

		    	// for (var i=0;i<rows.length;i++){
		    	// 	if(rows[i].xmsl==1){
		    	// 		//这块是如果没有的话就隐藏加号
		    	// 		dg.datagrid('getExpander', i).hide();
		    	// 	}
		    	// }
			}

		});
		
	}
	var datalist ="";
	function exportBb(){
		if(datalist==""){
			alert("请您先查询数据");
			return;
		}
		var  gydwstr="";

		var gydwdm=$("#gydw").combotree("getValues");
		if(gydwdm.length==0){
			gydwstr= $.cookie("unit2");

		}else if(gydwdm.length==1){
			if(gydwdm[0].substr(gydwdm[0].length-2,gydwdm[0].length)=="00") gydwdm[0]=gydwdm[0].substr(0,gydwdm[0].length-2);
			if(gydwdm[0].substr(gydwdm[0].length-2,gydwdm[0].length)=="00") gydwdm[0]=gydwdm[0].substr(0,gydwdm[0].length-2);
			gydwstr=gydwdm[0] ;
		}else{
			gydwstr= gydwdm.join(',');
		}

		var jhxdwh=$("#jwh").combobox("getText");
		if(jhxdwh.substr(0,1)==',')
			jhxdwh=jhxdwh.substr(1,jhxdwh.length);

		var zjlx=$("#zjlx").combobox("getValues").join(",");
		if(zjlx.substr(0,1)==',')
			zjlx=zjlx.substr(1,zjlx.length);

		var sfqbtxdw=$("#sfqbtxdw").combobox("getValues").join(",");
		if(sfqbtxdw.substr(0,1)==',')
			sfqbtxdw=sfqbtxdw.substr(1,sfqbtxdw.length);

		var data='xmmc='+$("#xmmc").val()+'&xmnf='+getValuesById("xmnf")+"&dwdm="+gydwstr+"&jwh="+jhxdwh
				+"&zjlx="+zjlx+"&sfqbtxdw="+sfqbtxdw;

		loadjzt();
		$.post('/jxcsxm/xtgl/exportBb_set.do',{gydw:gydwstr},function(){
			window.location.href='/jxcsxm/tjbb/exportZjqkdwdzbList.do?'+data;
		});
		setTimeout('disLoadjzt()',4000);
	}
	
	</script>
	<style type="text/css">
TD {
font-size: 12px;
}
a{
text-decoration:none;
}
.abgc_td td{padding-right:5px;}
</style>
</head>
<body>
	<div style="text-align: left; font-size: 12px; margin: 0px;">
		<table width="99.9%" border="0" style="margin-top: 1px; margin-left: 1px;" cellspacing="0" cellpadding="0">
			<tr>
					<div id="righttop">
						<div id="p_top">当前位置>&nbsp;统计报表>&nbsp;省补计划资金统计>&nbsp;资金请款与资金到位对账表</div>
					</div>
        	</tr>
        	<tr>
        		<td align="left" style="padding-left: 10px; padding-right: 10px;">
        			<fieldset style="width:99.9%; text-align: left; vertical-align: middle;margin: 8px 0px 0px 0px;">
        				<legend style="padding: 0 0 0 0; font-weight: bold; color: Gray; font-size: 12px;">
        					<font style="color: #0866A0; font-weight: bold"></font>
        				</legend>
        				<div>
        					<table style="margin:7px; vertical-align:middle;" cellspacing="0" class="abgc_td" >
					
								<tr height="28">
									<td align="right">管养单位：</td>
									<td><select id="gydw" style="width:165px;"></select></td>

									<td align="right">项目名称：</td>
									<td><input type='text' id="xmmc" style="width: 220px;" /></td>

									<td align="right">计划文号：</td>
									<td><select id="jwh" style="width: 165px;"></select></td>

									<td align="right">是否全部填写到位：</td>
									<td><select id="sfqbtxdw" style="width: 100px;"></select></td>

								</tr>

								<tr height="28">
									<td align="right">项目年份：</td>
									<td><select id="xmnf" style="width: 80px;"></select></td>

									<td align="right">资金类型：</td>
									<td><select id="zjlx" style="width: 100px;"></select></td>

								</tr>
        					
        					<tr height="28">
                            	<td colspan="8">
                            		<a id='mybuttion1' style="margin-top: 1px;margin-bottom: 1px;" href="javascript:getTbXmList()" onmouseover="szgq('button button-tiny button-glow button-rounded button-raised button-primary','mybuttion1')" onmouseout="szgq('button button-tiny button-rounded button-raised button-primary','mybuttion1')"  class="button button-tiny button-rounded button-raised button-primary">查询</a>
<%--									<a id='mybuttion2' style="margin-top: 1px;margin-bottom: 1px;" href="javascript:addsbzj()" onmouseover="szgq('button button-tiny button-glow button-rounded button-raised button-primary','mybuttion2')" onmouseout="szgq('button button-tiny button-rounded button-raised button-primary','mybuttion2')"  class="button button-tiny button-rounded button-raised button-primary">添加</a>--%>

<!--                             		<a id='mybuttion3' style="margin-top: 1px;margin-bottom: 1px;" href="javascript:importBb()" onmouseover="szgq('button button-tiny button-glow button-rounded button-raised button-primary','mybuttion3')" onmouseout="szgq('button button-tiny button-rounded button-raised button-primary','mybuttion3')"  class="button button-tiny button-rounded button-raised button-primary">导入报表</a> -->
<!--                             		<a id='mybuttion2' style="margin-top: 1px;margin-bottom: 1px;" href="javascript:exportBb()" onmouseover="szgq('button button-tiny button-glow button-rounded button-raised button-primary','mybuttion2')" onmouseout="szgq('button button-tiny button-rounded button-raised button-primary','mybuttion2')"  class="button button-tiny button-rounded button-raised button-primary">导出报表</a> -->
									    <a id='mybuttion2' style="margin-top: 1px;margin-bottom: 1px;" href="javascript:exportBb()" onmouseover="szgq('button button-tiny button-glow button-rounded button-raised button-primary','mybuttion2')" onmouseout="szgq('button button-tiny button-rounded button-raised button-primary','mybuttion2')"  class="button button-tiny button-rounded button-raised button-primary">导出报表</a>
								</td>
                            </tr>
							</table>
        				</div>
        			</fieldset>
        		</td>
        	</tr>
            <tr>
            	<td style="padding-top: 10px;padding-left:10px;padding-right:10px;">
                	<table id="grid"></table>
				</td>
			</tr>
		</table>
	</div>
</body>
</html>
